tests: Output errors to stderr, so they show up under "prove"
authorColin Walters <walters@verbum.org>
Fri, 4 Nov 2011 16:31:40 +0000 (12:31 -0400)
committerColin Walters <walters@verbum.org>
Fri, 4 Nov 2011 16:31:40 +0000 (12:31 -0400)
tests/libtest.sh

index 1c4ccc533d716b62f26c09fabc3acc26a319c9e3..a747019e03f529e3581b1e9d46c1070e003c9b6f 100644 (file)
@@ -36,22 +36,22 @@ die () {
 }
 
 assert_streq () {
-    test "$1" = "$2" || (echo "$1 != $2"; exit 1)
+    test "$1" = "$2" || (echo 1>&2 "$1 != $2"; exit 1)
 }
 
 assert_has_file () {
-    test -f "$1" || (echo "Couldn't find '$1'"; exit 1)
+    test -f "$1" || (echo 1>&2 "Couldn't find '$1'"; exit 1)
 }
 
 assert_not_has_file () {
     if test -f "$1"; then
-       echo "File '$1' exists"; exit 1
+       echo 1>&2 "File '$1' exists"; exit 1
     fi
 }
 
 assert_file_has_content () {
     if ! grep -q "$2" "$1"; then
-       echo "File '$1' doesn't match regexp '$2'"; exit 1
+       echo 1>&2 "File '$1' doesn't match regexp '$2'"; exit 1
     fi
 }